import React, { Component } from "react";
import memory from "../../utils/memory";
import { Redirect, Route, Switch } from "react-router-dom";
import { Layout } from "antd";
import LeftNav from "../../components/left-nav";
import Header from "../../components/header";
import Home from "./../home";
import Evaluation from "../evaluation";
import Refund from "../refund";
import Configurat from "../configurat";
import Banner from "../banner";
import ReturnInfo from "../returninfo";
import OrderQueryHome from "../order_query/home";
import GeneralSet from "../general-set";
import OperatRecord from "../operat-record";
import StaffManager from "../staff-manager";
import Conpon from "../conpon/home";
import GoodsClass from "../goodsClass";
import Commodity from "../commodity";
import IncomeDetail from "../income-detail";

import OrderQueryDetail from "../order_query/order_query_detail";

const { Footer, Sider, Content } = Layout;
export default class Admin extends Component {
  render() {
    const user = memory.user;
    if (!user || typeof user == "object") {
      console.log("admin....user");
      return <Redirect to="/login" />;
    }

    return (
      <Layout style={{ height: "100%" }}>
        <Sider>
          <LeftNav />
        </Sider>

        <Layout>
          <Header></Header>
          <Content
            style={{
              margin: 15,
              borderRadius: 5
            }}
          >
            <Switch>
              <Route path="/home" component={Home} />
              <Route path="/evaluation" component={Evaluation} />
              <Route path="/orderquery" component={OrderQueryHome} />
              <Route path="/refund" component={Refund} />
              <Route path="/configurat" component={Configurat} />
              <Route path="/banner" component={Banner} />
              <Route path="/returninfo" component={ReturnInfo} />
              <Route path="/generalset" component={GeneralSet} />
              <Route path="/operatrecord" component={OperatRecord} />
              <Route path="/operatrecord" component={OperatRecord} />
              <Route path="/staffmanager" component={StaffManager} />
              <Route path="/conpon" component={Conpon} />
              <Route path="/commodity" component={Commodity} />
              <Route path="/GoodsClass" component={GoodsClass} />
              <Route path="/incomeDetail" component={IncomeDetail} />
              <Redirect to="/home" />
            </Switch>
          </Content>
          {/* <Footer
            style={{
              width: "100%",
              textAlign: "center",
              position: "fixed",
              bottom: 0
            }}
          >
            Footer
          </Footer> */}
        </Layout>
      </Layout>
    );
  }
}
